Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    selected: 0,
    list: [{
      "pagePath": "pages/main/main",
      "iconPath": "../images/nav/main_un.png",
      "selectedIconPath": "../images/nav/main_check.png",
      "text": "首页"
    }, {
      "pagePath": "pages/orderHistory/orderhistory",
      "iconPath": "../images/nav/good_un.png",
      "selectedIconPath": "../images/nav/good_check.png",
      "text": "点单"
    },{
      "pagePath": "pages/order/order",
      "iconPath": "../images/nav/order_un.png",
      "selectedIconPath": "../images/nav/order_check.png",
      "text": "订单"
    },{
      "pagePath": "pages/individualCenter/individualCenter",
      "text": "我的",
      "iconPath": "../images/nav/mine_un.png",
      "selectedIconPath": "../images/nav/mine_check.png"
    }],
    // 遮罩层变量
    animationData: "",
    showModalStatus: true,
  },

  /**
   * 组件的方法列表
   */
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = '/'+data.path
      console.log(url)
      this.setData({
        selected: data.index,
      })
      wx.switchTab({
        url
      })
    },
     // 显示遮罩层  
   showModal: function () {
    //创建一个动画实例animation。调用实例的方法来描述动画。
    var animation = wx.createAnimation({
      duration: 500,         //动画持续时间500ms
      timingFunction: "ease",//动画以低速开始，然后加快，在结束前变慢
      delay: 0               //动画延迟时间0ms
    })
    this.animation = animation
    //调用动画操作方法后要调用 step() 来表示一组动画完成
    animation.translateY(130).step()//     在Y轴向上偏移300
    this.setData({
      //通过动画实例的export方法导出动画数据传递给组件的animation属性。
      animationData: animation.export(),
      showModalStatus: true  //显示遮罩层
    })
    setTimeout(function () {
      animation.translateY(0).step()
      this.setData({
        animationData: animation.export()
      })
    }.bind(this), 1)
  },

    // 隐藏遮罩层  
    hideModal: function () {
      var animation = wx.createAnimation({
        duration: 500,
        timingFunction: "ease",
        delay: 0
      })
      this.animation = animation;
      animation.translateY(130).step()
      this.setData({
        animationData: animation.export(),
      })
      setTimeout(function () {
        animation.translateY(0).step()
        this.setData({
          animationData: animation.export(),
          showModalStatus: false
        })
      }.bind(this), 200)
    },
  },
  onShow(){
    
  },
  
})
